package com.itheima.controller;

import com.itheima.pojo.Order;
import com.itheima.pojo.Result;
import com.itheima.service.impl.OrderServiceImpl;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Log4j2
@RestController
@RequestMapping("/order")
public class OrderController {


    @Autowired
    private OrderServiceImpl orderServiceImpl;


    @PostMapping("/submit")
    public Result placeOrder(@RequestBody Order order){
        return orderServiceImpl.placeOrder(order);
    }


    // TODO: 2022/10/21 订单列表
    @GetMapping("/user")
    public Result orderList(@RequestParam Integer page,
                            @RequestParam Integer pageSize){
        return orderServiceImpl.orderList(page,pageSize);
    }
}
